#include "rect.h"
#include <iostream>
#include <sstream>
using namespace std;

Point::Point(int x, int y) 
: m_x(x), m_y(y) {
}

int Point::x() const {
     return m_x;
}

void Point::setX(int x) {
     m_x = x;
}

int Point::y() const {
     return m_y;
}

void Point::setY(int y) {
     m_y = y;
}

string Point::toString() {
     ostringstream os;
     os << "Point(" << x() << "," << y() << ")";
     return os.str();
}

Rect::Rect(int x, int y, int width, int height)
: m_x(x), m_y(y), m_width(width), m_height(height) {
}

int Rect::x() const {
     return m_x;
}

void Rect::setX(int x) {
     m_x = x;
}

int Rect::y() const {
     return m_y;
}

void Rect::setY(int y) {
     m_y = y;
}

int Rect::width() const {
     return m_width;
}

void Rect::setWidth(int width) {
     m_width = width;
}

int Rect::height() const {
     return m_height;
}

void Rect::setHeight(int height) {
     m_height = height;
}

bool Rect::inside(Point p) {
     if (p.x() >= x() && p.x()< x() + width() &&
	 p.y() >= y() && p.y() < y() + height())
	  return true;
     return false;
}

string Rect::toString() {
     ostringstream os;
     os << "Rect(" << x() << "," << y() << "," << width() << "," << height() << ")";
     return os.str();
}
